<?php
    //$rsNewsDetail = getNewsDetail($param[1]); chuyen sang file news_left
    $rsNewsCat = getCategoryById($rsNewsDetail['cat_id']);
    
    $site_title = $rsNewsDetail['title'].' - '.$rsNewsCat['cat_title'].' - Tin tức - '.$CONFIG['site_title'];
    $site_keyword = $rsNewsDetail['title'].', '.$rsNewsCat['cat_title'].', '.$CONFIG['site_title'];
    $site_keyword = $site_keyword.', '.noSignSiteTitle($site_keyword);
    $site_description = $rsNewsDetail['title'].', '.$rsNewsCat['cat_title'].','.$CONFIG['site_title'];
    $site_description = $site_description .', '. noSignSiteTitle($site_description);
    set_page_title_meta($site_title,$site_keyword,$site_description);
?>

<div class="center_news_detail">
    <div class="center_news_tt_home" style="padding-left: 15px;width:95%">
        <div class="toplink" style="width: 100%; margin-top: 0px;padding-bottom: 10px;border-bottom: 1px solid #d1d1d1"><img src="/images/iconhome.gif" /><a href="#"><b>[Trang chủ]</b></a>&raquo;<a href="#" >[Tin tức]</a>&raquo;<a class="pagehere" title="<?php echo htmlentities_utf8($rsNewsCat['cat_title']); ?>"><?php echo $rsNewsCat['cat_title']?></a></div>


    </div>
    
    <div class="news_detaisl">
        <ul>
            <li>
                <h2><a href="<?php echo get_link('news', 'detail', $rsNewsDetail['title_link']) ;?>" title="<?php echo $rsNewsDetail['title'];?>"><?php echo $rsNewsDetail['title'];?></a></h2>
                <p><a href="<?php echo get_link('news', 'cat', $rsNewsCat['cat_link'])?>" title="<?php echo $rsNewsCat['cat_title'];?>"><?php echo $rsNewsCat['cat_title'];?></a> - <a href="<?php echo get_link('news', 'archive', get_my_date($rsNewsDetail['create_date'],'Y-m'))?>"><?php echo  get_my_date($rsNewsDetail['create_date']);?></a></p><br /><br />
                <b><?php echo $rsNewsDetail['description'];?></b>
                <br /><br />
					<?php echo $rsNewsDetail['content'];?>
            </li>
        </ul>    

        <div class="un_details">
            <img src="/images/print.gif" /><a href="javascript:window.print();">[In ra]</a><img src="/images/email.gif" /><a class="thickbox" title="Gửi cho bạn bè" href="#TB_inline?height=450&width=500&inlineId=sendFriend">[Gửi bạn bè]</a>
            <!-- AddThis Button BEGIN 
            <script type="text/javascript">var addthis_pub = "emptyboyls";</script>
            <a rel="nofollow" href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script>
          AddThis Button END -->
        </div>

    </div>

    <?php
    $rsLastOtherNews = getOrtherNewsByCat($rsNewsCat["cat_id"], $rsNewsDetail['create_date']);
    if($db->num_rows($rsLastOtherNews)) {
        ?>
    <div class="othernew_title"><img src="/images/icon2.gif" />[Các bài đã đăng]</div>
    <div class="link_othernews">
            <?php
            while($otherNews=$db->fetch_array($rsLastOtherNews)) {
                ?>
        <img src="/images/point2.gif" alt="<?php echo $otherNews['title'];?>" /><a href="<?php echo get_link("news","detail",$otherNews["title_link"]); ?>" title="<?php echo htmlentities($otherNews['title']);?>"><?php echo $otherNews['title'];?> (<?php echo get_my_date($otherNews["create_date"]); ?>)</a><br />
            <?php }?>
    </div>
    <?php }?>


    <div id="sendFriend" class="folder-body00" style="display: none;height:350px" >
    <script type="text/javascript" language="javascript">
        function checkEmail(address) {
            var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
            if(reg.test(address) == false) {
                return false;
            }
            return true;
        }
        function submitSendFriend()
        {
            if($('#name').val()==''){
                $('#name').attr('border-color', 'red', 'style');
                $('#name').focus();
                return false;
            }
            if($('#email_to').val()==''){
                $('#email_to').attr('border-color', 'red', 'style');
                $('#email_to').focus();
                return false;
            }
            if(checkEmail($('#email_to').val())==false){
                alert('Bạn nhập email không đúng, xin vui lòng nhập lại!');
                $('#email_to').focus();
                return false;
            }
            if($('#title').val()==''){
                $('#title').attr('border-color', 'red', 'style');
                $('#title').focus();
                return false;
            }
            if($('#content').val()==''){
                $('#content').attr('border-color', 'red', 'style');
                $('#content').focus();
                return false;
            }

            $.ajax({
                url: AJAX_PROCESS_URL+'sendFiend',
                type: 'post',
                data: "name="+$('#name').val()+'&email_from='+$('#email_from').val()+'&email_to='+$('#email_to').val()+'&title='+$('#title').val()+'&content='+$('#content').val()+'&url='+window.location.href,
                error: function(){
                    alert('Connection error!');
                },
                success: function(data){
                    if(data=='die'){
                        alert('Error');
                    }
                    $('#TB_closeWindowButton').click()
                }
            });

        }


    </script>
<div class="line_dangtin" style="margin-left: 20px;font-weight: bold;margin-top: 20px;width: 97%">
        <div><?php echo $_SESSION['msgContact'];unset ($_SESSION['msgContact'])?></div>
        <form id="frmSendFriend" method="POST" onsubmit="">
            <ul>
                <li>
                    <div class="line_dt_l" style="width: 22%;">Tên của bạn <font color="#f87310">(*)</font></div>
                    <div class="line_dt_r"><input type="text" id="name" name="name" style="width: 80%;"></div>
                </li>
                <li>
                    <div class="line_dt_l" style="width: 24%;">Email người nhận <font color="#f87310">(*)</font></div>
                    <div class="line_dt_r">
                        <input type="text" id="email_to" name="email_to" style="width: 80%;"/>
                    </div>
                </li>
                <li>
                    <div class="line_dt_l" style="width: 22%;">Tiêu đề <font color="#f87310">(*)</font></div>
                    <div class="line_dt_r"><input type="text" style="width: 80%;" value="" id="title" name="title"></div>
                </li>
                <li>
                    <div class="line_dt_l" style="width: 22%;">Nội dung <font color="#f87310">(*)</font></div>
                    <div class="line_dt_r"><textarea id="content" name="content" rows="6" cols="20" style="width:80%;height: 100px;"></textarea></div>
                </li>
                <li >
                    <div class="line_dt_l" style="width: 22%;">&nbsp;</div>
                    <input type="hidden" name="post_contact" value="okie" />
                    <div class="line_dt_r"><img style="cursor: pointer" src="/images/btn_send.gif" onclick="submitSendFriend();" name="sendFriendSubmit"/></div>
                </li>


            </ul>
        </form>
    </div>
</div>
</div>